home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MCASM.RAR / MC_ASM.EXE / WROX_ASM / CH9 / UNERASE / UNERASE.ASM < prev   
Assembly Source File  |  1994-05-23  |  15KB  |  822 lines

  1. MODEL SMALL
  2. .STACK 100H
  3. .386
  4.  
  5. EXTRN    get_sector:far
  6. EXTRN    set_sector:far
  7.  
  8. .DATA
  9.  
  10. mes0        db    ' Name    Ext  Attr    Status '
  11. mes1        db    '  Label $'
  12. mes2        db    '  SubDir$'
  13. mes3        db    '        $'
  14. mes4        db    '  Erased$'
  15. mes5        db    'Input first letter:$'
  16. mes6        db    'Recovered succesfuly$'
  17. mes7        db    'Can not been recovered$'
  18. mes8        db    '                      $'
  19. mes9        db    'Input drive letter:$'
  20.  
  21. buffer1        db    1024 dup(?)
  22. buffer2        db    1024 dup(?)
  23. buffer3        db    '                              '
  24.  
  25. ; FAT
  26. startfat    dw    ?    ; Starting sector of the FAT
  27. endfat        dw    ?    ; Ending sector of the FAT
  28. lengthfat    dw    ?    ; Length of the FAT
  29. fatcnt        db    ?    ; The number of the FATs
  30. fattype        db    ?    ; Type of the FAT
  31. fatpersect    dw    ?    ; the number of FAT's entries per sector
  32. localfatptr    dw    ?    ; Pointer to the FAT's entry
  33. fatsector    dw    ?    ; FAT's sector
  34. fatpreventry    dw    ?    ; Previous entry of the FAT
  35. fatprevsect    dw    ?    ; Previousely read FAT's sector
  36. ; ROOT
  37. startroot    dd    ?    ; Starting sector of the root
  38. endroot        dd    ?    ; Ending sector of the root
  39. lengthroot    dw    ?    ; Length of the root
  40. rootpersect    dw    ?    ; The number of the root's entries in a sector
  41. rootsector    dd    ?    ; Already read sector of the root
  42.  
  43. localrootptr    dw    ?    ; Pointer to the root's entry
  44. ; DISK
  45. DRIVENUM    dw    ?    ; Drive number
  46. sectorsize    dw    ?    ; Size of the sector
  47. clustsize    dw    ?    ; Cluster size
  48. startdata    dd    ?    ; Begining sector of the data
  49.  
  50. ; UNERASE
  51. rootentry    dw    ?    ; Offset to the current unerasing file in root
  52. startclust    dw    ?    ; Starting cluster of the file
  53. fileatrib    db    ?    ; File's atribute
  54. filesize    dw    ?    ; File size in clusters
  55. firstchar    db    '$'
  56.  
  57. ; SCREEN
  58. xcur        db    ?
  59. ycur        db    ?
  60.  
  61. ; int25h packet
  62. i25startsec    dd    ?
  63. i25seccnt    dw    ?
  64. i25off        dw    ?
  65. i25seg        dw    ?
  66.  
  67. .CODE
  68.         mov    bx,sp        ; Free memory
  69.         mov    cl,4
  70.         shr    bx,cl
  71.         inc    bx
  72.         mov    ax,ss
  73.         add    bx,ax
  74.         mov    ax,es
  75.         sub    bx,ax
  76.         mov    ah,4ah
  77.         int    21h
  78.         jnc    @@unerase_010
  79.         jmp    @@unerase_exit
  80.  
  81. @@unerase_010:    mov    ax,@DATA
  82.         mov    ds,ax
  83.  
  84.         mov    ax,0600h    ; Clear screen
  85.         xor    cx,cx
  86.         mov    dh,24
  87.         mov    dl,79
  88.         mov    bh,7
  89.         int    10h
  90.  
  91.         call    getdrive    ; Get drive letter
  92.  
  93.         call    initdata    ; Initialize data
  94.         cmp    ax,-1
  95.         je    @@unerase_exit
  96.  
  97. @@unerase_020:    call    screenmenu
  98.         cmp    ax,1
  99.         je    @@unerase_exit
  100.  
  101.         call    enterchar
  102.  
  103.         call    unerase
  104.  
  105.         call    message
  106.  
  107.         jmp    short @@unerase_020
  108.  
  109. @@unerase_exit:    mov    ax,4c00h
  110.         int    21h
  111.  
  112.  
  113. unerase        PROC    C NEAR
  114.         USES    bx,cx,dx,di,es
  115.  
  116.         mov    ax,ds
  117.         mov    es,ax
  118.  
  119.         mov    fatprevsect,-1
  120.  
  121.         mov    bx,startclust
  122.         call    getfatentry
  123.         cmp    ax,0
  124.         je    @@uner_010
  125.         mov    ax,-1        ; File can not be recovered
  126.         ret
  127. @@uner_010:    mov    bx,rootentry
  128.         mov    al,firstchar
  129.         mov    byte ptr ds:[bx],al
  130.  
  131.         lea    ax,buffer1
  132.         call    FAR PTR set_sector C,DRIVENUM,rootsector,ax,ds,1
  133.  
  134.         mov    al,fileatrib        ; SubDir
  135.         test    al,10h
  136.         je    @@uner_020
  137.         inc    word ptr filesize
  138. @@uner_020:
  139.         mov    cx,filesize        ; File size in clusters
  140.         cmp    cx,0            ; File have 0 bytes length
  141.         jne    @@uner_030
  142.         xor    ax,ax
  143.         ret
  144. @@uner_030:    dec    cx
  145.  
  146. ; Unerasing loop.
  147.         mov    bx,startclust        ; Starting cluster
  148.         mov    fatpreventry,bx
  149. @@uner_050:    call    getfatentry    ; Return the FAT's entry in AX, load
  150.                     ; the next sector of the FAT if it
  151.                     ; unnecessary. DX=-1 if end of the FAT
  152.         cmp    ax,0        ; Free entry
  153.         je    @@uner_060
  154.         inc    bx        ; Next cluster
  155.         jmp    short    @@uner_050
  156. @@uner_060:    cmp    cx,0
  157.         je    @@uner_070
  158.         mov    ax,fatpreventry
  159.         call    setfatentry C,0,ax,bx    ; Set next cluster in chain
  160.         mov    fatpreventry,bx
  161.         inc    bx
  162.         dec    cx
  163.         jmp    short @@uner_050
  164. @@uner_070:    mov    ax,fatpreventry
  165.         call    setfatentry C,0,ax,bx
  166.         call    setfatentry C,1,bx,0    ; Last cluster in chain
  167.  
  168.         xor    ax,ax
  169.         ret
  170.  
  171. getfatentry    PROC
  172.         push    di
  173.         push    cx
  174.  
  175.         mov    al,fattype
  176.         cmp    al,12
  177.         jne    @@getfat_001
  178.         xor    edx,edx
  179.         mov    ax,bx        ; 12-bit FAT
  180.         mov    dx,bx
  181.         shr    dx,1
  182.         add    edx,eax
  183.         jmp    short @@getfat_002
  184. @@getfat_001:
  185.         xor    edx,edx
  186.         mov    dx,bx        ; 16-bit FAT
  187.         shl    edx,1
  188.  
  189. @@getfat_002:    push    edx
  190.         mov    ax,dx
  191.         shr    edx,16
  192.         mov    cx,sectorsize
  193.         div    cx
  194.         mov    di,ax
  195.         xor    dx,dx
  196.         mul    cx
  197.         shl    edx,16
  198.         or    eax,edx
  199.         pop    edx
  200.  
  201.         sub    edx,eax
  202.         mov    localfatptr,dx
  203.  
  204.         cmp    di,endfat    ; End of FAT
  205.         je    @@getfat_040
  206.  
  207.         cmp    di,fatprevsect    ; Check for reading from disk
  208.         je    @@getfat_010
  209.  
  210.         cmp    fatprevsect,-1    ; First read
  211.         jne    @@getfat_005
  212.         mov    fatprevsect,di
  213.         jmp    short @@getfat_008
  214. @@getfat_005:    ; Save previous sector
  215.         xor    edx,edx
  216.         mov    dx,fatprevsect
  217.         add    dx,startfat
  218.         mov    fatprevsect,di    ; Save sector to the FAT
  219.         lea    di,buffer2
  220.         call    set_sector C,DRIVENUM,edx,di,ds,1
  221. @@getfat_008:    ; Read next sector
  222.         xor    edx,edx
  223.         mov    dx,fatprevsect    ; Load 2 sectors from the FAT
  224.         add    dx,startfat
  225.         lea    di,buffer2
  226.         call    get_sector C,DRIVENUM,edx,di,ds,2
  227.  
  228. @@getfat_010:    lea    di,buffer2
  229.         add    di,localfatptr        ; Get FAT's entry
  230.         mov    ax,word ptr es:[di]
  231.         mov    cl,fattype        ; Check FAT type
  232.         cmp    cl,12
  233.         jne    @@getfat_030
  234.         test    bx,1            ; 12-bit FAT
  235.         jnz    @@getfat_020
  236.         and    ax,0000111111111111b
  237.         jmp    short @@getfat_030
  238. @@getfat_020:    mov    cl,4
  239.         shr    ax,cl
  240. @@getfat_030:    xor    dx,dx
  241.         pop    cx
  242.         pop    di
  243.         ret
  244. @@getfat_040:    mov    dx,-1
  245.         pop    cx
  246.         pop    di
  247.         ret
  248. getfatentry    ENDP
  249.  
  250. setfatentry    PROC    C NEAR
  251.         ARG    entrytype:word,entrynum:word,nextentry:word
  252.         USES    bx,cx,di
  253.  
  254.         mov    bx,entrynum
  255.  
  256.         mov    al,fattype
  257.         cmp    al,12
  258.         jne    @@setfat_001
  259.         xor    edx,edx
  260.         xor    eax,eax
  261.         mov    ax,bx        ; 12-bit FAT
  262.         mov    dx,bx
  263.         shr    edx,1
  264.         add    edx,eax
  265.         jmp    short @@setfat_002
  266. @@setfat_001:
  267.         mov    ax,bx        ; 16-bit FAT
  268.         movzx    edx,bx
  269.         shl    edx,1
  270. @@setfat_002:
  271.         push    edx
  272.         mov    ax,dx
  273.         shr    edx,16
  274.         mov    cx,sectorsize
  275.         div    cx
  276.         xor    dx,dx
  277.         mul    cx
  278.         shl    edx,16
  279.         or    eax,edx
  280.         pop    edx
  281.  
  282.         sub    edx,eax
  283.         mov    localfatptr,dx
  284.  
  285.         lea    di,buffer2
  286.         add    di,localfatptr        ; Get FAT's entry
  287.  
  288.         cmp    entrytype,0
  289.         je    @@setfat_030
  290.  
  291.         mov    ax,0ffffh        ; Last chain
  292.  
  293.         mov    cl,fattype        ; Check FAT's type
  294.         cmp    cl,12
  295.         jne    @@setfat_015
  296.  
  297.         test    bx,1            ; 12-bit FAT
  298.         jnz    @@setfat_010
  299.         and    ax,0000111111111111b
  300.         or    word ptr ds:[di],ax
  301.         jmp    short @@setfat_020
  302. @@setfat_010:    mov    cl,4
  303.         shl    ax,cl
  304. @@setfat_015:    or    word ptr ds:[di],ax
  305.  
  306. @@setfat_020:    xor    edx,edx
  307.         mov    dx,fatprevsect        ; Write sector
  308.         add    dx,startfat
  309.         lea    di,buffer2
  310.         call    set_sector C,DRIVENUM,edx,di,ds,1
  311.         jmp    @@setfat_050
  312.  
  313. @@setfat_030:    mov    ax,nextentry        ; Next chain
  314.  
  315.         mov    cl,fattype        ; Check FAT's type
  316.         cmp    cl,12
  317.         jne    @@setfat_060
  318.  
  319.         test    bx,1            ; 12-bit FAT
  320.         jnz    @@setfat_040
  321.         and    ax,0000111111111111b
  322.         and    word ptr ds:[di],1111000000000000b
  323.         or    word ptr ds:[di],ax
  324.         jmp    short @@setfat_050
  325. @@setfat_040:    mov    cl,4
  326.         shl    ax,cl
  327.         and    word ptr ds:[di],0000000000001111b
  328.         or    word ptr ds:[di],ax
  329. @@setfat_050:    ret
  330.  
  331. @@setfat_060:    mov    word ptr ds:[di],ax    ; 16-bit FAT
  332.         ret
  333. setfatentry    ENDP
  334.  
  335. unerase        ENDP
  336.  
  337. initdata    PROC    C NEAR
  338.         USES    bx,cx,dx,di,si
  339.         mov    ax,DRIVENUM
  340.         mov    cx,1
  341.         xor    dx,dx
  342.         lea    bx,buffer1
  343.         int    25h
  344.         pop    dx
  345.         jnc    @@init_000
  346.         mov    word ptr i25startsec,0
  347.         mov    word ptr i25startsec+2,0
  348.         mov    i25seccnt,1
  349.         lea    ax,buffer1
  350.         mov    i25off,ax
  351.         mov    i25seg,ds
  352.         mov    ax,DRIVENUM
  353.         mov    cx,0ffffh
  354.         lea    bx,i25startsec
  355.         int    25h
  356.         pop    dx
  357.         jc    @@init_err
  358. @@init_000:    lea    bx,buffer1
  359.         mov    ax,word ptr ds:[bx+0bh]
  360.         mov    sectorsize,ax
  361.         mov    al,byte ptr ds:[bx+0dh]
  362.         xor    ah,ah
  363.         mov    clustsize,ax
  364.         mov    ax,word ptr ds:[bx+0eh]
  365.         mov    startfat,ax
  366.         mov    al,byte ptr ds:[bx+10h]
  367.         mov    fatcnt,al
  368.         mov    ax,word ptr ds:[bx+11h]
  369.         mov    lengthroot,ax
  370.  
  371.         mov    ax,word ptr ds:[bx+13h]    ; Calculating the type of the
  372.                         ; FAT
  373.         cmp    ax,0
  374.         je    @@init_005
  375.         xor    dx,dx
  376.                mov    cx,clustsize
  377.         div    cx
  378.         mov    cl,12
  379.         cmp    ax,0ff6h
  380.         jbe    @@init_010
  381. @@init_005:    mov    cl,16
  382. @@init_010:    mov    fattype,cl
  383.  
  384.         mov    ax,word ptr ds:[bx+16h]
  385.         mov    lengthfat,ax
  386.         add    ax,startfat
  387.         mov    endfat,ax
  388.  
  389.         mov    ax,sectorsize    ; Calculating the number of the FAT's
  390.                     ; entries per sector
  391.         mov    cx,8
  392.         mul    cx
  393.         mov    cl,fattype
  394.         xor    ch,ch
  395.         div    cx
  396.         cmp    dx,0
  397.         je    @@init_020
  398.         inc    ax
  399. @@init_020:    mov    fatpersect,ax
  400.  
  401.         mov    ax,lengthfat    ; Calculating the begin
  402.                     ; sector of the ROOT
  403.         mov    cl,fatcnt
  404.         xor    ch,ch
  405.         mul    cx
  406.         add    ax,startfat
  407.         mov    word ptr startroot,ax
  408.         mov    word ptr startroot+2,0
  409.         mov    word ptr rootsector,ax
  410.         mov    word ptr rootsector+2,0
  411.         mov    word ptr startdata,ax
  412.         mov    word ptr startdata+2,0
  413.  
  414.         mov    ax,sectorsize    ; Calculating the number of the root
  415.                     ; entries per sector
  416.         mov    cx,32
  417.         div    cx
  418.         mov    rootpersect,ax
  419.  
  420.         xor    eax,eax
  421.         mov    ax,lengthroot    ; Calculating the ending root's sector
  422.         mov    cx,32
  423.         mul    cx
  424.         mov    cx,sectorsize
  425.         div    cx
  426.         cmp    dx,0
  427.         je    @@init_030
  428.         inc    ax
  429. @@init_030:    mov    endroot,eax
  430.         add    startdata,eax
  431.  
  432.         mov    localfatptr,0
  433.         mov    localrootptr,0
  434.  
  435.         xor    ax,ax
  436.         ret
  437. @@init_err:    mov    ax,-1
  438.         ret
  439. initdata    ENDP
  440.  
  441. screenmenu    PROC    C NEAR
  442.         USES    bx,cx,dx,bp,es
  443. ; Return AX=: 1 - exit, 0 - unerase data prepared.
  444. @@scr_000:    mov    xcur,1
  445.         mov    ycur,1
  446.  
  447.         lea    bx,buffer1
  448.         call    FAR PTR get_sector C,DRIVENUM,rootsector,bx,ds,1
  449.  
  450. ; Display files
  451.         mov    ax,ds
  452.         mov    es,ax
  453.         mov    ax,1300h
  454.         mov    bx,63
  455.         mov    cx,29
  456.         xor    dx,dx
  457.         lea    bp,mes0
  458.         int    10h
  459.  
  460.         lea    bp,buffer1
  461.         mov    cx,rootpersect
  462.         mov    bx,7
  463.         mov    dh,1
  464.  
  465. @@scr_010:    push    cx
  466.         mov    al,byte ptr es:[bp]
  467.         cmp    al,0
  468.         jne    @@scr_0101
  469.  
  470.         push    bp
  471.         lea    bp,buffer3
  472.         mov    dl,xcur
  473.         mov    ax,1301h
  474.         mov    cx,30
  475.         int    10h
  476.         pop    bp
  477.         jmp    short @@scr_017
  478. ; Print the name
  479. @@scr_0101:    mov    dl,xcur
  480.         mov    ax,1301h
  481.         mov    cx,11
  482.         int    10h
  483.  
  484.         push    dx
  485.  
  486.         mov    ah,9
  487.         mov    al,byte ptr es:[bp+0bh]
  488.         cmp    al,8
  489.         jne    @@scr_011
  490.         lea    dx,mes1    
  491.         jmp    short @@scr_013
  492. @@scr_011:    test    al,10h
  493.         je    @@scr_012
  494.         lea    dx,mes2
  495.         jmp    short @@scr_013
  496. @@scr_012:    lea    dx,mes3
  497. @@scr_013:    int    21h
  498.  
  499.         lea    dx,mes3
  500.         mov    al,byte ptr es:[bp]
  501.         cmp    al,0E5h
  502.         jne    @@scr_014
  503.         lea    dx,mes4
  504. @@scr_014:    int    21h
  505.  
  506.         pop    dx
  507. @@scr_017:    inc    dh
  508.               add    bp,20h
  509.         pop    cx
  510.         loop    @@scr_010
  511.  
  512. @@scr_020:    call    clearpointer
  513.         call    setpointer
  514.  
  515. @@scr_030:    xor    ah,ah
  516.         int    16h
  517.  
  518.         cmp    ah,1        ; Esc
  519.         jne    @@scr_040
  520.         jmp    @@scr_exit
  521. @@scr_040:    cmp    ah,81        ; PgDn
  522.         jne    @@scr_050
  523.         mov    eax,startdata
  524.         dec    eax
  525.         cmp    eax,rootsector
  526.         jbe    @@scr_030
  527.         inc    dword ptr rootsector
  528.         jmp    @@scr_000
  529. @@scr_050:    cmp    ah,73        ; PgUp
  530.         jne    @@scr_060
  531.         mov    eax,startroot
  532.         cmp    eax,rootsector
  533.         jae    @@scr_030
  534.         dec    dword ptr rootsector
  535.         jmp    @@scr_000
  536. @@scr_060:    cmp    ah,80        ; Down
  537.         jne    @@scr_070
  538.         mov    ax,rootpersect
  539.         cmp    al,ycur
  540.         jbe    @@scr_030
  541.         inc    byte ptr ycur
  542.         jmp    @@scr_020
  543. @@scr_070:    cmp    ah,72        ; Up
  544.         jne    @@scr_080
  545.         mov    ax,1        ; !!!!!!!!!!!  May be changed !!!!!!!
  546.         cmp    al,ycur
  547.         jae    @@scr_030
  548.         dec    byte ptr ycur
  549.         jmp    @@scr_020
  550. @@scr_080:    cmp    ah,28        ; Enter
  551.         jne    @@scr_030
  552.  
  553.         lea    bx,buffer1    ; Prepare data for unerase
  554.         mov    al,ycur
  555.         dec    al
  556.         xor    ah,ah
  557.         mov    cx,32
  558.         mul    cx
  559.         add    bx,ax
  560.         mov    al,byte ptr ds:[bx]
  561.         cmp    al,0E5h
  562.         jne    @@scr_100
  563.  
  564.         mov    al,byte ptr ds:[bx+0bh]
  565.         mov    fileatrib,al        ; Atributes of the file
  566.         mov    ax,word ptr ds:[bx+1ah]    ; Starting cluster
  567.         mov    startclust,ax
  568.  
  569.         mov    ax,sectorsize        ; Calculating file size in
  570.                         ; clusters
  571.         mov    cx,clustsize
  572.         mul    cx
  573.         mov    cx,ax
  574.         mov    ax,word ptr ds:[bx+1ch]
  575.         mov    dx,word ptr ds:[bx+1eh]
  576.         div    cx
  577.         cmp    dx,0
  578.         je    @@scr_090
  579.         inc    ax
  580. @@scr_090:    mov    filesize,ax
  581.         mov    rootentry,bx
  582.         xor    ax,ax
  583.         ret
  584. @@scr_exit:    mov    ax,1
  585.         ret
  586. ; SubDir
  587. @@scr_100:    mov    al,byte ptr ds:[bx+0bh]    ; Attribute
  588.         test    al,10h
  589.         jne    @@scr_110
  590.         jmp    @@scr_030
  591. @@scr_110:    mov    ax,word ptr ds:[bx+1ah]
  592.         cmp    ax,0
  593.         je    @@scr_120
  594. ; SubDir cluster
  595.         sub    ax,2            ; ?????????????
  596.         mov    cx,clustsize
  597.         mul    cx
  598.         mov    cl,16
  599.         shl    edx,cl
  600.         or    eax,edx
  601.         add    eax,startdata
  602.         mov    startroot,eax
  603.         mov    rootsector,eax
  604.  
  605.         xor    edx,edx
  606.         mov    dx,clustsize
  607.         add    eax,edx
  608.         dec    eax
  609.         mov    endroot,eax
  610.  
  611.         jmp    @@scr_000
  612. ; ROOT
  613. @@scr_120:
  614.         xor    eax,eax
  615.         mov    ax,lengthfat    ; Calculating the begin
  616.                     ; sector of the ROOT
  617.         mov    cl,fatcnt
  618.         xor    ch,ch
  619.         mul    cx
  620.         add    ax,startfat
  621.         mov    startroot,eax
  622.         mov    rootsector,eax
  623.  
  624.         mov    ax,lengthroot    ; Calculating the ending root's sector
  625.         mov    cx,32
  626.         mul    cx
  627.         mov    cx,sectorsize
  628.         div    cx
  629.         cmp    dx,0
  630.         je    @@scr_130
  631.         inc    ax
  632. @@scr_130:    mov    endroot,eax
  633.         jmp    @@scr_000
  634.  
  635. clearpointer    PROC    C NEAR        ; Local procedure for clear screen
  636.                     ; pointers
  637.         USES    ax,bx,cx,dx
  638.  
  639.         mov    cx,rootpersect
  640. @@clear_010:    push    cx
  641.         mov    ah,2
  642.         xor    bh,bh
  643.         mov    dh,cl
  644.         mov    dl,0        ; !!!!!!!!!!!!!!!!!!!
  645.         int    10h
  646.  
  647.         mov    ah,9
  648.         mov    al,' '
  649.         mov    bx,7
  650.         mov    cx,1
  651.         int    10h
  652.  
  653.         pop    cx
  654.         push    cx
  655.  
  656.         mov    ah,2
  657.         xor    bh,bh
  658.         mov    dh,cl
  659.         mov    dl,12        ; !!!!!!!!!!!!!!!!!!!
  660.         int    10h
  661.  
  662.         mov    ah,9
  663.         mov    al,' '
  664.         mov    bx,7
  665.         mov    cx,1
  666.         int    10h
  667.  
  668.         pop    cx
  669.         loop    @@clear_010
  670.         ret
  671. clearpointer    ENDP
  672.  
  673. setpointer    PROC    C NEAR        ; Local procedure for set screen 
  674.                     ; pointer
  675.         USES    ax,bx,cx,dx
  676.         mov    ah,2
  677.         xor    bh,bh
  678.         mov    dh,ycur
  679.         mov    dl,0    ; !!!!!!!!!!!!!!!!!!!!
  680.         int    10h
  681.  
  682.         mov    ah,9
  683.         xor    bh,bh
  684.         mov    al,'>'
  685.         mov    cx,1
  686.         mov    bl,7
  687.         int    10h
  688.  
  689.         mov    ah,2
  690.         xor    bh,bh
  691.         mov    dh,ycur
  692.         mov    dl,12    ;!!!!!!!!!!!!!!!!!!!!!!!!!
  693.         int    10h
  694.  
  695.         mov    ah,9
  696.         xor    bh,bh
  697.         mov    al,'<'
  698.         mov    cx,1
  699.         mov    bl,7
  700.         int    10h
  701.         ret
  702. setpointer    ENDP
  703.  
  704. screenmenu    ENDP
  705.  
  706. enterchar    PROC    C NEAR
  707.         USES    ax,dx
  708.         mov    ah,2
  709.         xor    bh,bh
  710.         mov    dh,23
  711.         mov    dl,1
  712.         int    10h
  713.         mov    ah,9
  714.         lea    dx,mes5
  715.         int    21h
  716.  
  717.         xor    ah,ah
  718.         int    16h
  719.         cmp    al,97
  720.         jb    @@enter_020
  721.         cmp    al,122
  722.         ja    @@enter_020
  723. @@enter_010:    sub    al,32
  724.         jmp    short @@enter_040
  725. @@enter_020:    cmp    al,160
  726.         jb    @@enter_030
  727.         cmp    al,175
  728.         jbe    @@enter_010
  729. @@enter_030:    cmp    al,224
  730.         jb    @@enter_040
  731.         cmp    al,239
  732.         ja    @@enter_040
  733.         sub    al,96
  734. @@enter_040:    mov    firstchar,al
  735.  
  736.         mov    ah,2
  737.         xor    bh,bh
  738.         mov    dh,23
  739.         mov    dl,1
  740.         int    10h
  741.         mov    ah,9
  742.         lea    dx,mes8
  743.         int    21h
  744.         ret
  745. enterchar    ENDP
  746.  
  747. message        PROC    C NEAR
  748.         USES    ax,bx,dx
  749.         cmp    ax,-1
  750.         je    @@mess_010
  751.         mov    ah,2
  752.         xor    bh,bh
  753.         mov    dh,23
  754.         mov    dl,1
  755.         int    10h
  756.         mov    ah,9
  757.         lea    dx,mes6
  758.         int    21h
  759.         jmp    short @@mess_exit
  760. @@mess_010:    mov    ah,2
  761.         xor    bh,bh
  762.         mov    dh,23
  763.         mov    dl,1
  764.         int    10h
  765.         mov    ah,9
  766.         lea    dx,mes7
  767.         int    21h
  768. @@mess_exit:    xor    ah,ah
  769.         int    16h
  770.         mov    ah,2
  771.         xor    bh,bh
  772.         mov    dh,23
  773.         mov    dl,1
  774.         int    10h
  775.         mov    ah,9
  776.         lea    dx,mes8
  777.         int    21h
  778.         ret
  779. message        ENDP
  780.  
  781. getdrive    PROC    C NEAR
  782.         USES    bx
  783.         mov    ah,2
  784.         xor    bh,bh
  785.         mov    dh,11
  786.         mov    dl,28
  787.         int    10h
  788.         mov    ah,9
  789.         lea    dx,mes9
  790.         int    21h
  791. @@drv_010:    xor    ah,ah
  792.         int    16h
  793.  
  794.         cmp    al,65
  795.         jb    @@drv_010
  796.         cmp    al,90
  797.         ja    @@drv_020
  798.         sub    al,65
  799.         xor    ah,ah
  800.         mov    DRIVENUM,ax
  801.         jmp    short @@drv_030
  802. @@drv_020:    cmp    al,97
  803.         jb    @@drv_010
  804.         cmp    al,122
  805.         ja    @@drv_010
  806.         sub    al,97
  807.         xor    ah,ah
  808.         mov    DRIVENUM,ax
  809.  
  810. @@drv_030:    mov    ah,2
  811.         xor    bh,bh
  812.         mov    dh,11
  813.         mov    dl,28
  814.         int    10h
  815.         mov    ah,9
  816.         lea    dx,mes8
  817.         int    21h
  818.         ret
  819. getdrive    ENDP
  820.  
  821.         END
  822.